# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=plasma-camera
pkgver=1.0_git20200901
pkgrel=0
_commit="5f6f37b04f38bdf71dfea2f5995023d12584d0af"
pkgdesc="Camera application for Plasma Mobile"
arch="all !armhf" # armhf: qt5-qtdeclarative
url="https://invent.kde.org/plasma-mobile/plasma-camera"
license="GPL-3.0-or-later AND BSD-3-Clause"
depends="
	gst-plugins-bad
	gst-plugins-good
	kirigami2
	qt5-qtmultimedia
	"
makedepends="
	extra-cmake-modules
	kcoreaddons-dev
	ki18n-dev
	kirigami2-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsvg-dev
	"
source="https://invent.kde.org/plasma-mobile/plasma-camera/-/archive/$_commit/plasma-camera-$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare

	# qmlplugindump fails for armv7+qemu (pmb#1970). This is purely for
	# packager knowledge and doesn't affect runtime, so we can disable it.
	if [ "$CARCH" = "armv7" ]; then
		sed -i "s/ecm_find_qmlmodule/# ecm_find_qmlmodule/g" CMakeLists.txt
	fi
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="a5beb9ceeb23e44e81e3ffc209850907856cdfaa94b73b91bd9f8d9a4905e5e388cbfb7d5e76603561b8b2e2e9b0aa004c3c4f35166ba18054cb641b69837fb5  plasma-camera-5f6f37b04f38bdf71dfea2f5995023d12584d0af.tar.gz"
